package avicit.bdp.dds.server.worker.task.sparkflow.utils;

import avicit.bdp.common.utils.ConfigUtils;
import org.springframework.stereotype.Component;

/**
 * System parameter cache class
 * <p>
 * 1. There are several system parameters that do not need to be configured. The system parameter table does not need to be configured with related parameters. 2. The system parameters need to be configured in the data table and must be exactly the same as the attribute names of the class.
 * 3. If the parameter value is more than one, it will take precedence; if the number cannot be processed, then the number is
 * <p>
 * Note: The static properties of the cache class must be tested for cache value substitution, ensuring that the cache is used correctly.
 * <p>
 * Set constant rules
 * 1, the default set of constant values
 * 2, "spring" gets the settings from the "properties" file [static can not be injected, need "public" non-static "set" method]...
 * 3, database read settings
 */
@Component
public class FlowApiUtils {


    public static String getInterfaceUrlHead(){
        return ConfigUtils.getInstance().getString("piflow.url");
    }


    /**
     * spark jar path
     */
    public static String SPARK_JAR_PATH = "/sparkJar/path";


    public static String getSparkJarPathUrl() {
        return getInterfaceUrlHead() + SPARK_JAR_PATH;
    }

    /**
     * spark jar mount path
     */
    public static String SPARK_JAR_MOUNT_PATH = "/sparkJar/add";


    public static String getSparkJarMountUrl() {
        return getInterfaceUrlHead() + SPARK_JAR_MOUNT_PATH;
    }

    /**
     * spark jar mount path
     */
    public static String SPARK_JAR_UNMOUNT_PATH = "/sparkJar/remove";

    public static String getSparkJarUNMountUrl() {
        return getInterfaceUrlHead() + SPARK_JAR_UNMOUNT_PATH;
    }


    /**
     * "stop" detail interface
     */
    public static String STOPS_INFO_URL = "/stop/info";

    public static String getStopsInfoUrl() {
        return getInterfaceUrlHead() + STOPS_INFO_URL;
    }

    /**
     * Start the "flow" interface
     */
    public static String FLOW_START_URL = "/flow/start";


    public static String getFlowStartUrl() {
        return getInterfaceUrlHead() + FLOW_START_URL;
    }

    /**
     * Stop the "flow" interface
     */
    public static String FLOW_STOP_URL = "/flow/stop";

    public static String getFlowStopUrl() {
        return getInterfaceUrlHead() + FLOW_STOP_URL;
    }

    /**
     * "flow" basic information interface
     */
    public static String FLOW_INFO_URL = "/flow/info";

    public static String getFlowInfoUrl() {
        return getInterfaceUrlHead() + FLOW_INFO_URL;
    }

    /**
     * "flow" log interface
     */
    public static String FLOW_LOG_URL = "/flow/log";

    public static String getFlowLogUrl() {
        return getInterfaceUrlHead() + FLOW_LOG_URL;
    }

    public static String FLOW_LOGDETAIL_URL = "/flow/logdetail";

    public static String getFlowLogDetailUrl() {
        return getInterfaceUrlHead() + FLOW_LOGDETAIL_URL;
    }

    /**
     * "flow" progress interface
     */
    public static String FLOW_PROGRESS_URL = "/flow/progress";

    public static String getFlowProgressUrl() {
        return getInterfaceUrlHead() + FLOW_PROGRESS_URL;
    }

    /**
     * "flow checkpoints" interface
     */
    public static String FLOW_CHECKPOINTS_URL = "/flow/checkpoints";

    public static String getFlowCheckpointsUrl() {
        return getInterfaceUrlHead() + FLOW_CHECKPOINTS_URL;
    }

    /**
     * "flow debug" interface
     */
    public static String FLOW_DEBUG_DATA_URL = "/flow/debugData";

    public static String getFlowDebugDataUrl() {
        return getInterfaceUrlHead() + FLOW_DEBUG_DATA_URL;
    }

    /**
     * "flow debug" interface
     */
    public static String FLOW_DEBUG_DATA_ALL_URL = "/flow/debugDataAll";

    public static String getAllFlowDebugDataUrl() {
        return getInterfaceUrlHead() + FLOW_DEBUG_DATA_ALL_URL;
    }
    /**
     * "flow debug" interface
     */
    public static String FLOW_VISUALIZATION_DATA_URL = "/flow/visualizationData";


    public static String getFlowVisualizationDataUrl() {
        return getInterfaceUrlHead() + FLOW_VISUALIZATION_DATA_URL;
    }

}
